# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Vaporeon <vaporeon@vaporeon.io>

pkgname=corrosion
pkgver=0.3.5
pkgrel=1
pkgdesc='Tool for integrating Rust into an existing CMake project'
arch=(loong64 x86_64)
url='https://github.com/corrosion-rs/corrosion'
license=(MIT)
depends=(rust cmake)
source=(https://github.com/corrosion-rs/corrosion/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('3cee986d4a99fd965d70c96f6640eeff9723cc2815d367b22624ace53f3fd47a')

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBEXECDIR=lib \
    -DCORROSION_BUILD_TESTS=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 $pkgname-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
